package com.itheima.controller;


import com.itheima.common.R;
import com.itheima.domain.SkuStock;
import com.itheima.manager.PmsSkuStockManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class PmsSkuStockController {

    @Autowired
    PmsSkuStockManager pmsSkuStockManager;

    @PostMapping("/sku/update/{pid}")
    public R update(@PathVariable Integer pid, @RequestBody SkuStock skuStockList)
    {
        return pmsSkuStockManager.update(pid,skuStockList);

    }

    @GetMapping("/sku/{pid}")
    public R getByIdAndSku(@PathVariable Integer pid,@RequestParam(required = false)String keyword)
    {
        return pmsSkuStockManager.getByIdAndSku(pid,keyword);
    }

}
